#pragma once

#include <iostream>
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/thread.hpp>


using boost::asio::ip::udp;

class Server_UDP
{
public:
	Server_UDP(boost::asio::io_service& io_service, int port);
	~Server_UDP(void);
private:
	void start_receive();
	void handle_receive(const boost::system::error_code& /*error*/,
		std::size_t /*bytes_transferred*/);

	void handle_send(boost::shared_ptr<std::string> /*message*/,
		const boost::system::error_code& /*error*/,
		std::size_t /*bytes_transferred*/);

	udp::socket socket_;
	udp::endpoint remote_endpoint_;
	//boost::array<char, 1> recv_buffer_;
};


static boost::asio::io_service io_service;
static Server_UDP *gp_server = 0;